<!--
  - Copyright (c) 2018.
  - 北京九思金信科技有限公司对该文件内容保留所有权利。
  - 未经许可，不得私自拷贝、传播、发布、引用该文件内容，违者将被追究法律责任。
  -->
<template>
  <div class="myFontSize_box">
    <div class="myFontSize_title">
      <div class="myFontSize_title_return" @click="returnMy">
        <img src="@/pages/mobile/assets/img/Back@3x.png" alt />
        <span>设置</span>
      </div>
      <p>字体大小</p>
    </div>
    <div class="myFontSize_infos_box">
      <div
        class="myFontSize_infos_box_item"
        @click="setfontSizeEvent('小', 100)"
      >
        <span>小</span>
        <icon
          type="success-no-circle"
          size="20"
          class="fontActive"
          v-if="fontSizeNuber == 100"
        ></icon>
      </div>
      <div
        class="myFontSize_infos_box_item"
        @click="setfontSizeEvent('中', 110)"
      >
        <span>中</span>
        <icon
          type="success-no-circle"
          size="20"
          class="fontActive"
          v-if="fontSizeNuber == 110"
        ></icon>
      </div>
      <div
        class="myFontSize_infos_box_item"
        @click="setfontSizeEvent('大', 120)"
      >
        <span>大</span>
        <icon
          type="success-no-circle"
          size="20"
          class="fontActive"
          v-if="fontSizeNuber == 120"
        ></icon>
      </div>
    </div>
  </div>
</template>

<script>
import { XButton, Box, Icon } from "vux";
export default {
  components: {
    XButton, Box, Icon
  },
  data () {
    return {
      isFilter: false,
      cacheBox: false,
      fontSizeNuber: ''

    };
  },
  methods: {
    setfontSizeEvent (val, nub) {
      var obj = { "fontSizeName": val, "fontSizeNub": nub }
      localStorage.setItem("fontSizeData", JSON.stringify(obj));
      this.fontSizeQuery()
      var html = document.getElementsByTagName("html")[0]; //获取html元素
      var w = document.documentElement.clientWidth || document.body.clientWidth; //屏幕宽度（兼容处理）
      html.style.fontSize = (w * nub) / 370 + "px"; //370为设计稿宽度
    },
    fontSizeQuery () {
      this.fontSizeNuber = JSON.parse(localStorage.getItem("fontSizeData")) == null ? "100" : JSON.parse(localStorage.getItem("fontSizeData")).fontSizeNub
    },
    cacheGo () {
      this.isFilter = true;
      this.cacheBox = true;
    },
    cancelCache () {
      this.isFilter = false;
      this.cacheBox = false;
    },
    requestCache () {
      this.isFilter = false;
      this.cacheBox = false;
    },
    quitLogin () {
      this.$router.push({
        path: "/"
      });
    },
    returnMy () {
      this.$router.goBack();

    }
  },
  mounted () {
    // 字体大小
    this.fontSizeQuery()
  },
};
</script>

<style scoped lang="less">
.myFontSize_box {
  position: fixed;
  top: 0rem;
  bottom: 0.55rem;
  width: 100%;
  height: 100%;
  z-index: 200;
  overflow: hidden;
  background: #fbf9fe;
  //   z-index: 10;
  .myFontSize_title {
    width: 100%;
    height: 0.44rem;
    text-align: center;
    line-height: 0.44rem;
    background: #ffffff;
    box-shadow: inset 0 -1px 0 0 rgba(207, 207, 207, 0.2);
    .myFontSize_title_return {
      margin-top: -0.04rem;
      float: left;
      img {
        // width: 0.15rem;
        height: 0.205rem;
        padding-left: 0.085rem;
      }
      span {
        font-family: Regular;
        font-size: 0.17rem;
        color: #3e3e3e;
        letter-spacing: -0.41px;
        line-height: 0.22rem;
      }
    }
    p {
      font-family: Semibold;
      font-size: 0.17rem;
      color: #3e3e3e;
      letter-spacing: -0.41px;
      text-align: center;
      height: 0.44rem;
      line-height: 0.44rem;
      margin-left: 0.7rem;
      margin-right: 0.7rem;
    }
  }
  .myFontSize_infos_box {
    margin-top: 0.2rem;
    background: #ffffff;
    padding: 0.1rem;
    // position: absolute;
    // top: 50%;
    // transform: translate(0%, -50%);
    .myFontSize_infos_box_item {
      height: 0.44rem;
      margin-left: 0.24rem;
      border-bottom: 1px solid #f5f5f5;
      display: flex;
      align-items: center;
      span {
        font-family: PingFangSC-Medium;
        font-size: 0.15rem;
        color: #443a38;
        letter-spacing: -0.36px;
        line-height: 0.2rem;
        font-weight: 700;
      }
      .fontActive {
        position: absolute;
        right: 0.2rem;
        color: #c8161e;
      }
    }
  }
  .company_name {
    position: fixed;
    bottom: 0rem;
    left: 0rem;
    margin-top: -1rem;
    padding-left: 50%;
    height: 0.2rem;
    padding-right: -10rem;
    margin-left: -0.7rem;
    margin-bottom: 0.3rem;

    p {
      font-family: Regular;
      font-size: 0.12rem;
      color: #d7d7d7;
      letter-spacing: -0.19px;
      text-align: center;
    }
  }
}
</style>
